package com.cmc.printApplet;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.util.StringUtils;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;

public class CloseApplication {
    private Logger logger = LoggerFactory.getLogger(CloseApplication.class);



    public CloseApplication(ConfigurableApplicationContext context) {
        String orgIds = context.getEnvironment().getProperty("spring.profiles.orgId");
        logger.info("配置的orgIds为"+orgIds);
        if (StringUtils.isEmpty(orgIds)){
            logger.error("检测到spring.profiles.orgId配置项没有配置，停止springBoot应用程序");
            context.close();
        }
        logger.info("orgId["+orgIds+"]已配置,成功启动");
    }
}



